﻿<template>
    <div id="app">
        <mt-header v-bind:title="title" style="background-color:#fda10e">
            <a slot="left" @click="back()">返回</a>

        </mt-header>

        <div class="mui-content">
            <div class="mui-content-padded">
                <div class="mui-inline">输入反馈的内容</div>

            </div>
            <div class="row mui-input-row">
                <textarea id='question' style="height: 400px;" class="mui-input-clear question" placeholder="" v-model="content"></textarea>
            </div>
            <p style="text-align:center;margin-top:20px;padding-bottom:20px;">
                <Button type="error" shape="circle" style="width:80%;background-color:#fea00a" @click="sub">提交</Button>
            </p>

        </div>

    </div>
</template>

<script>
    import Bus from '../bus.js'
    import { Toast } from 'mint-ui';
    import header from '../components/header.vue';
    export default {
        name: 'app',
        data() {
            return {
                title: "意见反馈",
                content:""
            }
        },
        mounted() {
            //window.history.pushState('forward', null, '#');
            //window.history.forward(1);
            //window.onpopstate = () => {
            //    Bus.$emit('val', "show");
            //    this.$router.replace("sign");
            //}
        },
        components: {
            'h-header': header,
        },
        methods: {
            sub: function () {
              
                var userid = window.localStorage.getItem("userid");
                var mid = window.localStorage.getItem("mid");
                var content = this.$data.content;


                var _this = this;
                this.$api.post('wx/Index/feedback', {
                    "userid": userid, "mid": mid, "content": content
                }, response => {
                    if (response.status >= 200 && response.status < 300) {
                        console.log(response.data);
                        var data = response.data;
                        if (data.status == 200) {
                            Toast(data.message);
                            Bus.$emit('val', "show");
                            this.$router.go(-1);
                          

                        }



                    } else {
                        console.log(response.message);
                        //请求失败，response为失败信息
                    }
                });
            },
            back: function () {
                Bus.$emit('val', "show");
                this.$router.go(-1);

            }
        },
        created: function () {
           
        }
    }
</script>

<style scoped>
    .mui-content{
        background-color:#ffffff;
    }
</style>